package net.javamine.blog.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Digits;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 实体类
 * 
 * @author <a href="mailto:java_lht@163.com">Lht</a>
 * @since 2012-11-30
 * @version 1.0
 */
@Entity
@Table(name = "tb_blog_blogs")
public class BlogEntity implements Serializable {
	
	private static final long serialVersionUID = -6536447677452064124L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "BlogId")
	private long blogId;		//ID
	
	@Column(name = "BlogTitle")
	@NotBlank(message="不可为空")
	@Length(max = 255, message = "长度必须小于或等于255字节")
	private String blogTitle;		//博客标题
	
	@Column(name = "BlogContent")
	@NotBlank(message="不可为空")
	@Length(max = 5000, message = "长度必须小于或等于5000字节")
	private String blogContent;		//博客正文
	
	@Column(name = "BlogScanCount")
	@NotBlank(message="不可为空")
	@Digits(integer = 10, fraction = 0, message="数字精度超出范围")
	private int blogScanCount;		//博客浏览数
	
	@Column(name = "BlogPopularityCount")
	@NotBlank(message="不可为空")
	@Digits(integer = 10, fraction = 0, message="数字精度超出范围")
	private int blogPopularityCount;		//博客好评数
	
	@Column(name = "BlogTopTime")
	private Timestamp blogTopTime;		//博客置顶时间
	
	@Column(name = "BlogCreateTime")
	@NotBlank(message="不可为空")
	private Timestamp blogCreateTime;		//博客创建时间
	
	@Column(name = "BlogUpdateTime")
	@NotBlank(message="不可为空")
	private Timestamp blogUpdateTime;		//博客最后一次修改时间
	
	@Column(name = "BlogTag")
	@NotBlank(message="不可为空")
	@Length(max = 255, message = "长度必须小于或等于255字节")
	private String blogTag;		//博客标签、关键字
	
	@Column(name = "CategroryId")
	@NotBlank(message="不可为空")
	@Digits(integer = 20, fraction = 0, message="数字精度超出范围")
	private long categroryId;		//博客类别ID
	
	@Column(name = "UserId")
	@Digits(integer = 20, fraction = 0, message="数字精度超出范围")
	private long userId;		//博客用户（作者）ID
	
	
	public long getBlogId() {
		return blogId;
	}

	public void setBlogId(long blogId) {
		this.blogId = blogId;
	}
	
	public String getBlogTitle() {
		return blogTitle;
	}

	public void setBlogTitle(String blogTitle) {
		this.blogTitle = blogTitle;
	}
	
	public String getBlogContent() {
		return blogContent;
	}

	public void setBlogContent(String blogContent) {
		this.blogContent = blogContent;
	}
	
	public int getBlogScanCount() {
		return blogScanCount;
	}

	public void setBlogScanCount(int blogScanCount) {
		this.blogScanCount = blogScanCount;
	}
	
	public int getBlogPopularityCount() {
		return blogPopularityCount;
	}

	public void setBlogPopularityCount(int blogPopularityCount) {
		this.blogPopularityCount = blogPopularityCount;
	}
	
	public Timestamp getBlogTopTime() {
		return blogTopTime;
	}

	public void setBlogTopTime(Timestamp blogTopTime) {
		this.blogTopTime = blogTopTime;
	}
	
	public Timestamp getBlogCreateTime() {
		return blogCreateTime;
	}

	public void setBlogCreateTime(Timestamp blogCreateTime) {
		this.blogCreateTime = blogCreateTime;
	}
	
	public Timestamp getBlogUpdateTime() {
		return blogUpdateTime;
	}

	public void setBlogUpdateTime(Timestamp blogUpdateTime) {
		this.blogUpdateTime = blogUpdateTime;
	}
	
	public String getBlogTag() {
		return blogTag;
	}

	public void setBlogTag(String blogTag) {
		this.blogTag = blogTag;
	}
	
	public long getCategroryId() {
		return categroryId;
	}

	public void setCategroryId(long categroryId) {
		this.categroryId = categroryId;
	}
	
	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}
	
}